import java.util.ArrayList;
import java.util.List;

import twitter4j.Query;
import twitter4j.QueryResult;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;

public class QuerySearch {

	public List<String> searchTerm(Twitter twitter, String query)
			throws TwitterException {

		Query myQuery = new Query();
		myQuery.setCount(100);
		myQuery.setQuery(query);
		QueryResult queryResult = twitter.search(myQuery);
		List<Status> tweets = queryResult.getTweets();
		List<String> tweetList = new ArrayList<String>();
		for (int i = 0; i < tweets.size(); i++) {
			tweetList.add(tweets.get(i).getText());
		}
		return tweetList;
	}

}
